package com.chang.soul.service.imp;

import com.chang.soul.bean.PaperAnalysisBean;
import com.chang.soul.bean.PaperAnalysisQueryForm;
import com.chang.soul.dao.PaperAnalysisMapper;
import com.chang.soul.service.PaperAnalysisService;
import com.chang.soul.util.ResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class PaperAnalysisServiceImp implements PaperAnalysisService {
    @Autowired
    PaperAnalysisMapper paperAnalysisMapper;

    @Override
    public boolean insertAnalysis(PaperAnalysisBean paperAnalysisBean) {
       try {
           paperAnalysisMapper.insertAnalysis(paperAnalysisBean);
       }catch (Exception e){
           System.out.println(e);
           return false;
       }
       return true;
    }

    @Override
    public boolean deleteAnalysisById(Integer id) {
        try {
            paperAnalysisMapper.deleteAnalysisById(id);
        }catch (Exception e){
            System.out.println(e);
            return false;
        }
        return true;
    }

    @Override
    public List<PaperAnalysisBean> getAllAnalysisList(PaperAnalysisQueryForm paperAnalysisQueryForm) {
        return paperAnalysisMapper.getAllAnalysisList(paperAnalysisQueryForm);
    }

    @Override
    public Integer getAnalysisCount() {
        return paperAnalysisMapper.getAnalysisCount();
    }

    @Override
    public Integer getCountByAnalysisList(PaperAnalysisQueryForm paperAnalysisQueryForm) {
        return paperAnalysisMapper.getCountByAnalysisList(paperAnalysisQueryForm);
    }

    @Override
    public PaperAnalysisBean getAnalysisByPaperId(Integer paperId) {
        return paperAnalysisMapper.getAnalysisByPaperId(paperId);
    }

    @Override
    public boolean updateAnalysis(PaperAnalysisBean paperAnalysisBean) {
        try {
            paperAnalysisMapper.updateAnalysis(paperAnalysisBean);
        }catch (Exception e){
            System.out.println(e);
            return false;
        }
        return true;

    }
}
